package com.zhuhjay.system.domain.vo;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

/**
 * 用户修改用户信息的VO对象
 * @author ZhuHJay
 * @date 2022/3/24 22:14
 */
@Data
public class UserInfo {

    @Getter(AccessLevel.NONE)
    @Setter(AccessLevel.NONE)
    private final String telephoneReg = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$";

    /** 用户昵称 **/
    @NotBlank(message = "用户昵称不能为空")
    @Length(min = 2, max = 7, message = "用户昵称长度为2-7")
    private String userNike;

    /** 性别 **/
    @Min(value = 0, message = "请正确选择性别")
    @Max(value = 1, message = "请正确选择性别")
    private Integer sex;

    /** 手机号码 **/
    @NotBlank(message = "手机号码不能为空")
    @Pattern(regexp = telephoneReg, message = "手机号格式错误")
    private String telephone;

    /** 邮箱格式 **/
    @Email(message = "邮箱格式不正确")
    private String email;

    /** 居住地址 **/
    @NotBlank(message = "居住地址不能为空")
    @Length(min = 5, max = 60, message = "居住地址长度为5-60字")
    private String address;
}
